#!/bin/bash -ev
###
 # @Author: WangYu
 # @Date: 2023-03-16 09:21:59
 # @LastEditors: WangYu
 # @LastEditTime: 2023-08-09 09:26:56
 # @FilePath: /docker-telemac/docker/setup-1-apt.sh
 # @Description: 
 # @copyright: Copyright (c) 2023 by WangYu, All Rights Reserved. 
### 

# debian dependencies + python libs

TELEMAC_MAJOR_VER=$(echo $TELEMAC_MASCARET_VER | cut -c 1-2)
if [[ $TELEMAC_MAJOR_VER == "v7"  ]]; then
    PYTHON_PKGS="python python-pip"
    PIP_PKGS="numpy matplotlib==2.0.2 scipy jupyter"
    export PYTHON="python"
        
    sed -i 's/<partel.par>/PARTEL.PAR/' ${TELEMAC_ROOT}/systel.cfg
else
    PYTHON_PKGS="python3 python3-pip"
    PIP_PKGS="numpy matplotlib scipy jupyter"
    export PYTHON="python3"
    export PYTHON_VERSION=3
fi

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get -o Dpkg::Options::="--force-confold" upgrade -q -y
apt-get -o Dpkg::Options::="--force-confold" install -q -y \
    libopenmpi-dev openmpi-bin gfortran subversion less \
    cmake swig vim curl zlib1g-dev libffi-dev libjpeg-dev libblas-dev liblapack-dev ${PYTHON_PKGS}